$OpenBSD: patch-src_libopensc_card-entersafe_c,v 1.1 2016/09/01 13:24:19 dcoppa Exp $

commit f64c71da28d1c1401445f6e8fa45bc079d5b6cd9
Author: Ian Young <ian@iay.org.uk>
Date:   Sat Aug 27 22:14:04 2016 +0100

Don't free file if pointer is null

Protect against segmentation

--- src/libopensc/card-entersafe.c.orig	Thu Sep  1 14:57:18 2016
+++ src/libopensc/card-entersafe.c	Thu Sep  1 14:58:01 2016
@@ -493,7 +493,7 @@ static int entersafe_select_fid(sc_card_t *card,
 	path.len=2;
 
 	r = iso_ops->select_file(card,&path,&file);
-	if(r) sc_file_free(file);
+	if(r && file) sc_file_free(file);
 	SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
 
 	/* update cache */
